package com.juanLL.CMC.models;

import android.graphics.Bitmap;
import android.graphics.Rect;

import com.juanLL.CMC.AssetLoader;

/**
 * 
 * RecycleBin class extends model, simulates a recycle bin in the game
 * 
 */
public class RecycleBin extends Model {

	public Rect rightSideRect;
	public Rect leftSideRect;
	public Rect topSideRect;
	public Rect centerRect;

	// enum that contains the type and path to bitmap of all trash objects
	public static enum recycleBinEnum {
		GBIN(Model.TYPE_GLASS, AssetLoader.PATH_RECYCLEBIN_GLASS), PBIN(
				Model.TYPE_PLASTIC, AssetLoader.PATH_RECYCLEBIN_PLASTIC), OBIN(
				Model.TYPE_ORGANIC, AssetLoader.PATH_RECYCLEBIN_ORGANIC);

		public int type;
		public String path;

		recycleBinEnum(int type, String path) {
			this.type = type;
			this.path = path;
		}
	}

	/**
	 * RecycleBin constructor
	 * 
	 * @param type
	 *            the type id
	 * @param bitmap
	 *            the bitmap that represents the object graphically
	 * @param screenRes
	 *            the screen resolution stored in a Rect object
	 */
	public RecycleBin(int type, Bitmap bitmap, Rect screenRes, float x, float y) {
		this.type = type;
		this.bitmap = bitmap;
		this.x = x;
		this.y = y;
		initSideRects();
	}

	/**
	 * initSideRects method, takes position and bitmap values set up in the
	 * constructos and initialies the 3 Rect objects that will cover the bin's
	 * left, right and top sides.
	 */
	public void initSideRects() {
		rightSideRect = new Rect((int) x + bitmap.getWidth(), (int) y, (int) x
				+ bitmap.getWidth(), (int) y + bitmap.getHeight());
		leftSideRect = new Rect((int) x, (int) y, (int) x, (int) y
				+ bitmap.getHeight());
		centerRect = new Rect((int) x + bitmap.getWidth() / 4, (int) y
				+ bitmap.getHeight() / 4, (int) x + bitmap.getWidth()
				- bitmap.getWidth() / 4, (int) y + bitmap.getHeight()
				- bitmap.getHeight() / 4);
	}
}
